@import "../../themes/ionic.globals.md";

// Material Design Item
// --------------------------------------------------

/// @prop - Font size of the item text
$item-md-body-text-font-size:        1.4rem !default;

/// @prop - line height of the item text
$item-md-body-text-line-height:      1.5 !default;

/// @prop - Color of the item paragraph
$item-md-paragraph-text-color:       #666 !default;

/// @prop - Font size of the item
$item-md-font-size:                  1.6rem !default;

/// @prop - Size of the avatar in the item
$item-md-avatar-size:                40px !default;

/// @prop - Size of the thumbnail in the item
$item-md-thumbnail-size:             80px !default;

/// @prop - Shows the detail arrow icon on an item
$item-md-detail-push-show:           false !default;

/// @prop - Color of the detail arrow icon
$item-md-detail-push-color:          $list-md-border-color !default;

/// @prop - Icon for the detail arrow
$item-md-detail-push-svg:            "<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 20'><path d='M2,20l-2-2l8-8L0,2l2-2l10,10L2,20z' fill='#{$item-md-detail-push-color}'/></svg>" !default;

/// @prop - Color for the divider
$item-md-divider-color:              #858585 !default;

/// @prop - Background for the divider
$item-md-divider-background:         #fff !default;

/// @prop - Font size for the divider
$item-md-divider-font-size:          $item-md-body-text-font-size !default;

/// @prop - Border bottom for the divider
$item-md-divider-border-bottom:      1px solid $list-md-border-color !default;

/// @prop - Padding for the divider
$item-md-divider-padding:            5px 15px !default;

/// @prop - Background for the sliding content
$item-md-sliding-content-background: $list-md-background-color !default;


.item-md {
  position: relative;

  padding-right: 0;
  padding-left: ($item-md-padding-left);

  font-size: $item-md-font-size;
  font-weight: normal;
  text-transform: none;

  color: $list-md-text-color;
  background-color: $list-md-background-color;
  box-shadow: none;
  transition: background-color 300ms cubic-bezier(.4, 0, .2, 1);
}

.item-md.activated {
  background-color: $list-md-activated-background-color;
}

.item-md[no-lines] {
  border-width: 0;
}

.item-md h1 {
  margin: 0 0 2px;

  font-size: 2.4rem;
  font-weight: normal;
}

.item-md h2 {
  margin: 2px 0;

  font-size: 1.6rem;
  font-weight: normal;
}

.item-md h3,
.item-md h4,
.item-md h5,
.item-md h6 {
  margin: 2px 0;

  font-size: 1.4rem;
  font-weight: normal;
  line-height: normal;
}

.item-md p {
  overflow: inherit;

  margin: 0 0 2px;

  font-size: 1.4rem;
  line-height: normal;
  text-overflow: inherit;
  color: $item-md-paragraph-text-color;
}

.item-md.item-block .item-inner {
  padding-right: ($item-md-padding-right / 2);

  border-bottom: 1px solid $list-md-border-color;
}


// Material Design Item Detail Push
// --------------------------------------------------

// Only show the forward arrow icon if true
@if $item-md-detail-push-show == true {
  .item-md[detail-push] .item-inner,
  button.item-md:not([detail-none]) .item-inner,
  a.item-md:not([detail-none]) .item-inner {
    @include svg-background-image($item-md-detail-push-svg);

    padding-right: 32px;

    background-repeat: no-repeat;
    background-position: right ($item-md-padding-right - 2) center;
    background-size: 14px 14px;
  }
}


// Material Design Item Media
// --------------------------------------------------

.item-md [item-left],
.item-md [item-right] {
  margin: $item-md-padding-media-top ($item-md-padding-right / 2) $item-md-padding-media-bottom 0;
}

.item-md ion-icon[item-left],
.item-md ion-icon[item-right] {
  margin-top: $item-md-padding-icon-top;
  margin-bottom: $item-md-padding-icon-bottom;
  margin-left: 0;
}

.item-md .item-button {
  padding: 0 .6em;

  height: 25px;

  font-size: 1.2rem;
}

.item-md .item-button[icon-only] ion-icon,
.item-md .item-button[icon-only] {
  padding: 0 1px;
}

.item-md ion-icon[item-left] + .item-inner,
.item-md ion-icon[item-left] + .item-input {
  margin-left: $item-md-padding-left + ($item-md-padding-left / 2);
}

.item-md ion-avatar[item-left],
.item-md ion-thumbnail[item-left] {
  margin: ($item-md-padding-right / 2) $item-md-padding-right ($item-md-padding-right / 2) 0;
}

.item-md ion-avatar[item-right],
.item-md ion-thumbnail[item-right] {
  margin: ($item-md-padding-right / 2);
}


// Material Design Item Avatar
// --------------------------------------------------

.item-md ion-avatar {
  min-width: $item-md-avatar-size;
  min-height: $item-md-avatar-size;
}

.item-md ion-avatar ion-img,
.item-md ion-avatar img {
  width: $item-md-avatar-size;
  height: $item-md-avatar-size;

  border-radius: 50%;

  overflow: hidden;
}


// Material Design Item Thumbnail
// --------------------------------------------------

.item-md ion-thumbnail {
  min-width: $item-md-thumbnail-size;
  min-height: $item-md-thumbnail-size;
}

.item-md ion-thumbnail ion-img,
.item-md ion-thumbnail img {
  width: $item-md-thumbnail-size;
  height: $item-md-thumbnail-size;
}


// Material Design Item Group
// --------------------------------------------------

ion-item-group .item-md:first-child .item-inner {
  border-top-width: 0;
}

ion-item-group .item-md:last-child .item-inner,
ion-item-group .item-md .item-wrapper:last-child .item-inner {
  border: 0;
}


// Material Design Item Divider
// --------------------------------------------------

.item-divider-md {
  padding-left: $item-md-padding-left;

  color: $item-md-divider-color;
  background-color: $item-md-divider-background;

  border-bottom: $item-md-divider-border-bottom;
  font-size: $item-md-divider-font-size;
}


// Generate Material Design Item and Item Divider Colors
// --------------------------------------------------

@each $color-name, $color-base, $color-contrast in get-colors($colors-md) {
  // If there is text with a color it should use this color
  // and override whatever item sets it to
  .item-md .text-md-#{$color-name} {
    color: $color-base;
  }

  .item-md-#{$color-name},
  .item-divider-md-#{$color-name} {
    color: $color-contrast;
    background-color: $color-base;

    p {
      color: $color-contrast;
    }

    &.activated {
     background-color: color-shade($color-base);
    }
  }
}


// Material Design Item Sliding
// --------------------------------------------------

.list-md ion-item-sliding {
  background-color: $item-md-sliding-content-background;
}

// Item reorder
// --------------------------------------------------

.item-md ion-reorder {
  font-size: 1.5em;
  opacity: .3;
}
